/** @format */
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
// import vueDevTools from "vite-plugin-vue-devtools";
import uni from '@dcloudio/vite-plugin-uni'
import tailwindcss from '@tailwindcss/vite'

const baseUrl = './src'
const path = (url = '', base = baseUrl) => fileURLToPath(new URL(base + `/${url}`, import.meta.url))

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [
        uni.default(),
        tailwindcss(),
        // vueDevTools()
    ],
    resolve: {
        // 自定义路径别名
        alias: {
            // 样式资源 assets
            '@iconfont': path('assets/iconfont'),
            '@styles': path('assets/styles'),
            // 静态资源
            '@static': path('static'),
            // 视图组件 views
            '@components': path('views/components'),
            '@pages': path('views/pages'),
            // 依赖库 libs
            '@apis': path('libs/apis'),
            '@stores': path('libs/stores'),
            '@utils': path('libs/utils'),
            // 源码根目录 src
            // "@types": "/src/types",
            '@': path(),
        },
        dedupe: ['vue'],
    },
    server: {
        port: 8888,
    },
})
